package cn.iocoder.an.module.mold.controller.admin.upkeeptask.vo;

import cn.iocoder.an.module.mold.dal.dataobject.account.AccountDO;
import cn.iocoder.an.module.mold.dal.dataobject.drawingno.DrawingNoDO;
import cn.iocoder.an.module.mold.dal.dataobject.upkeepcategory.UpkeepCategoryDO;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.util.*;

import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import cn.idev.excel.annotation.*;
import cn.iocoder.an.framework.excel.core.annotations.DictFormat;
import cn.iocoder.an.framework.excel.core.convert.DictConvert;

@Schema(description = "管理后台 - 模具保养任务 Response VO")
@Data
@ExcelIgnoreUnannotated
public class UpkeepTaskRespVO implements VO {

    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20225")
    @ExcelProperty("主键")
    private Long id;

    @Schema(description = "保养单号", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("保养单号")
    private String code;

    @Schema(description = "图号id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15140")
    @Trans(type = TransType.SIMPLE, target = DrawingNoDO.class, fields = "drawingNo", ref = "drawingNo")
    private Long drawingNoId;

    @Schema(description = "图号")
    @ExcelProperty("图号")
    private String drawingNo;

    @Schema(description = "模具id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11520")
    @ExcelProperty("模具id")
    @Trans(type = TransType.SIMPLE, target = AccountDO.class, fields = {"name", "code"}, refs = {"accountName", "accountCode"})
    private Long accountId;

    @Schema(description = "模具名", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @ExcelProperty("模具名")
    private String accountName;

    @Schema(description = "编码", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("编码")
    private String accountCode;

    @Schema(description = "接收人Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6308")
    @ExcelProperty("接收人Id")
    @Trans(type = TransType.SIMPLE, targetClassName = "cn.iocoder.an.module.system.dal.dataobject.user.AdminUserDO", fields = "nickname", ref = "assigneerName")
    private Long assigneerId;

    @Schema(description = "接收人名字")
    @ExcelProperty("接收人名字")
    private String assigneerName;

    @Schema(description = "保养人Ids")
    @ExcelIgnore
    private List<Long> assigneerIds;

    @Schema(description = "保养类型id", example = "15479")
    @ExcelProperty("保养类型id")
    @Trans(type = TransType.SIMPLE, target = UpkeepCategoryDO.class, fields = {"name", "accountMethod"}, refs = {"upkeepCategory", "accountMethod"})
    private Long upkeepId;

    //保养分类
    @Schema(description = "保养分类", example = "工装保养")
    @ExcelProperty("保养分类")
    private String upkeepCategory;

    @Schema(description = "任务状态", example = "2")
    @ExcelProperty(value = "任务状态", converter = DictConvert.class)
    @DictFormat("mold_upkeep_task_status") // TODO 代码优化：建议设置到对应的 DictTypeConstants 枚举类中
    private Integer status;

    @Schema(description = "计划保养日期")
    @ExcelProperty("计划保养日期")
    private LocalDateTime nextUpkeepTime;

    @Schema(description = "实际保养日期")
    @ExcelProperty("实际保养日期")
    private LocalDateTime realUpkeepTime;

    @Schema(description = "任务下达时间")
    @ExcelProperty("任务下达时间")
    private LocalDateTime taskCreateTime;

    @Schema(description = "任务接收时间")
    @ExcelProperty("任务接收时间")
    private LocalDateTime taskReceiveTime;

    @Schema(description = "作业开始时间")
    @ExcelProperty("作业开始时间")
    private LocalDateTime jobStartTime;

    @Schema(description = "任务开始时间")
    @ExcelProperty("任务开始时间")
    private LocalDateTime taskStartTime;

    @Schema(description = "任务结束时间")
    @ExcelProperty("任务结束时间")
    private LocalDateTime taskEndTime;

    @Schema(description = "任务执行时长")
    @ExcelProperty("任务执行时长")
    private Double taskExecutionDuration;


    @Schema(description = "实际开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("实际开始时间")
    private LocalDateTime actualStartTime;

    @Schema(description = "实际结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("实际结束时间")
    private LocalDateTime actualEndTime;

    @Schema(description = "实际执行时长")
    @ExcelProperty("实际执行时长")
    private Double actualExecutionDuration;

    @Schema(description = "保养完整")
    @ExcelProperty("保养完整")
    private Boolean isCompleted;

    @Schema(description = "任务执行时长")
    private String auditDescription;


    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

}
